<template>
    <div class="shop-list">
        <h1>商家列表</h1>
        <table border>
            <thead>
                <th>排名</th>
                <th>名称</th>
                <th>人气榜</th>
                <th>口碑值</th>
            </thead>
            <tbody>
                <tr :key="index" v-for="(item, index) in shopList">
                    <td>{{ index + 1 }}</td>
                    <td>{{ item.name }}</td>
                    <td>{{ item.count }}</td>
                    <td>
                        {{ item.koubei }}
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script>
import axios from 'axios';
export default {
    name: 'ShopList',
    data() {
        return {
            shopList: [],
        };
    },
    mounted() {
        this.getShopList();
    },
    methods: {
        async getShopList() {
            const res = await axios.get('/api/ratings');
            // console.log(res);
            this.shopList = res.data;
        },
    },
};
</script>

<style lang="less" scoped></style>
